package com.ddstation.crm.menu.controller;

import java.util.HashMap;
import java.util.Map;
import javax.inject.Inject;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ddstation.crm.login.util.WnSessionUtil;
import com.ddstation.crm.menu.service.MENU_FILTER_ENUM;
import com.ddstation.crm.menu.service.MenuService;

/**
 * 《健康管理平台》 菜单
 * @author zhangdifeng
 * @date 2017年7月12日
 */
@Controller
public class HorizontalMenuController {

	/**
	 * 纵向菜单
	 * @param session
	 * @return
	 */
	@RequestMapping(value="wncrm_horizontal_menu.do", method = RequestMethod.POST)
	public @ResponseBody Map<String, Object> getHorizontalMenuEvent(
			@RequestParam String userUUID,
			HttpSession session) {

		// 从session获取登录用户基础数据
		String institutionId = WnSessionUtil.getInstitutionId(session);
		Integer supervisorId = WnSessionUtil.getSupervisorId(session);
		Map<String, Object> retMap = new HashMap<String, Object>();
		retMap.put("menus", menuService.getHorizontalMenu(institutionId, supervisorId, MENU_FILTER_ENUM.INSTITUTION_AND_DOCTOR));
//		retMap.put("superManager", WnSessionUtil.isSuperManager(session));
		retMap.put("errorcode", 0);
		return retMap;
	}
	
//	/**
//	 * 菜单设置
//	 * @param session
//	 * @return
//	 */
//	@RequestMapping(value="wncrm_horizontal_menu.do/settting/init", method = RequestMethod.POST)
//	public @ResponseBody Map<String, Object> getHorizontalMenuSettingEvent(
//			HttpSession session) {
//
//		// 从session获取登录用户基础数据
//		String institutionId = WnSessionUtil.getInstitutionId(session);
//		Integer doctorId = WnSessionUtil.getDoctorId(session);
//		Map<String, Object> retMap = new HashMap<String, Object>();
//		retMap.put("errcode", 0);
//		retMap.put("menus", menuService.intInstitutionHorizontalMenuSetting(institutionId, doctorId));
//		return retMap;
//	}
	
//	/**
//	 * 菜单设置
//	 * @param session
//	 * @return
//	 */
//	@RequestMapping(value="wncrm_horizontal_menu.do/settting/save", method = RequestMethod.POST)
//	public @ResponseBody Map<String, Object> saveHorizontalMenuSettingEvent(
//			@RequestBody List<DtHealthManageInstitutionMenuCustomizeEntity> rules,
//			HttpSession session) {
//
//		// 从session获取登录用户基础数据
//		String institutionId = WnSessionUtil.getInstitutionId(session);
//		Map<String, Object> retMap = new HashMap<String, Object>();
//		menuService.saveInstitutionHorizontalMenuSetting(institutionId, rules);
//		retMap.put("errcode", 0);
//		return retMap;
//	}
	
//	private static final Logger logger = LoggerFactory.getLogger(MainMenuController.class);
	@Inject private MenuService menuService = null;
}
